<?php


namespace app\parent\controller\v1;

use app\common\controller\ParentController;
use app\parent\service\TaskService;

class Task extends ParentController
{
    /**
     * 作业列表
     * User: wufeng
     * Date: 2020/03/01.
     */
    public function taskLists()
    {
        if ($this->request->isPost()) {
            $list = (new TaskService($this->type))->taskLists();
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 作业班级列表
	 * User: wufeng
	 * Date: 2020/03/11
	 *
	 */
    public function taskClassLists()
    {
        if ($this->request->isPost()) {
			$params = $this->request->param();
            $list = (new TaskService($this->type))->taskClassLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 作业详情列表
     * User: wufeng
     * Date: 2020/03/01.
     */
    public function taskDetailLists()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new TaskService($this->type))->taskDetailLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 作业详情
     * User: wufeng
     * Date: 2020/03/03.
     */
    public function taskDetail()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new TaskService($this->type))->taskDetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 提交作业
     * User: wufeng
     * Date: 2020/03/09.
     */
    public function submissionWork()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new TaskService($this->type))->submissionWork($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
}
